package com.obas.integration.element.telnet.loader;

import java.util.List;

import com.ease.common.util.OutputUtil;
import com.ease.integration.telent.TelnetClient;
import com.ease.integration.telent.TelnetExecutionCallback;
import com.obas.model.business.DeviceMacAddress;

public class HWMA5680TTelnetDeviceMacAddressLoader extends HWDefaultTelnetDeviceMacAddressLoader {

	public String doLoadRawDeviceMacAddress() {
		return this.execute(new TelnetExecutionCallback<String>() {

			public String execute(TelnetClient telnetClient) {

				telnetClient.request("enable");
				telnetClient.response(null);

				telnetClient.request(command);
				telnetClient.response(null);
				telnetClient.response(null);// telnetClient.response("{ <cr>||<K> }:");

				telnetClient.request(" ");
				telnetClient.response(null);
				return telnetClient.response(null);
			}
		});
	}

	public static void main(String[] args) {

		HWMA5680TTelnetDeviceMacAddressLoader retriever = new HWMA5680TTelnetDeviceMacAddressLoader();

		retriever.setHost("192.168.239.5");
		retriever.setPort(23);
		retriever.setUsername("root");
		retriever.setPassword("huawei123");

		retriever.setUsernamePrompt("User name:");
		retriever.setPasswordPrompt("User password:");
		retriever.setMorePrompt("---- More ( Press 'Q' to break ) ----");
		retriever.setCommand("disp mac-address all");

		List<DeviceMacAddress> deviceMacAddresses = retriever.loadDeviceMacAddress();

		OutputUtil.p(deviceMacAddresses);

	}
}
